//
// Created by myrica on 3/30/25.
//

#ifndef REMOVEUNREACHABLEOPERATION_H
#define REMOVEUNREACHABLEOPERATION_H

#include <memory>

#include "mlir/Dialect/Func/IR/FuncOps.h.inc"
#include "mlir/Pass/Pass.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Pass/Pass.h"

namespace irispass {
    std::unique_ptr<mlir::Pass> createRemoveUnreachableOperationPass();

    struct RemoveUnreachableOperation : public mlir::PassWrapper<RemoveUnreachableOperation, mlir::OperationPass<
                mlir::ModuleOp> > {
        mlir::StringRef getArgument() const final { return "remove-unreachable-operation"; }

        mlir::StringRef getDescription() const final {
            return "Remove unreachable operations after terminators in each block";
        }

        void runOnOperation() override;
    };
}


#endif //REMOVEUNREACHABLEOPERATION_H
